<template>
    <div class="hoverSearch" @mouseover="showFlag=true" @mouseleave="onLeave">
        <div class="ibtn">
            <!-- <el-icon size="22px" color="#999"><Operation /></el-icon> -->
            <img src="/src/assets/scbtn.png" alt="">
        </div>
        <div class="searchbox" :style="position" v-show="showFlag">
            <div class="tcbox">
                <img class="sjIcon" src="/src/assets/jt.png">
                <slot/>
            </div>
        </div>
    </div>
</template>

<script setup>
import {ref,onMounted} from 'vue'
const props = defineProps({
    position:'', // 弹出框位置
    showPop:true
})

const showFlag = ref(false)
const close = ()=>{
    showFlag.value = false
}
const onLeave =()=>{
    if(props.showPop){
        showFlag.value = false
    }
}
onMounted( () => {
})

defineExpose({close})
</script>

<style lang="scss" scoped>
.hoverSearch{
    position: relative;
    z-index: 1001;
    width: 100%;
    height: 100%;
    .ibtn{
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        i{
            cursor: pointer;
        }
        img{
            display: block;
            width: 18px;
            cursor: pointer;
            &:hover{
                opacity: 0.7;
            }
        }
    }
    &:hover{
        .searchbox{
            display: block;
        }
    }
    .searchbox{
        //display: none;
        position: absolute;
        z-index: 1001;
        min-width: 100px;
        min-height: 100px;
        left: 51px;
        top: 0;
        background: #FFFFFF;
        box-shadow: 0 0 16px rgba(0,0,0,0.1);
        border: 1px solid #E7E7E7;
        border-radius: 5px;
        .tcbox{
            position: relative;
            z-index: 1002;
            .sjIcon{
                position: absolute;
                z-index: 1001;
                left: -13px;
                top: 4px;
                display: block;
                height: 32px;
            }
        }
 
    }
    
}
</style>